package com.wxk.order.handler;

import com.wxk.entity.http.HttpResult;
import com.wxk.entity.http.HttpStatus;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletResponse;
@ControllerAdvice
public class GlobalExceptionHandler {
    @ResponseBody
    @ExceptionHandler(value = Exception.class)
    public HttpResult globalException(HttpServletResponse response, Exception ex){
        return HttpResult.error(HttpStatus.ERROR,ex.getMessage());
    }
}
